#ifndef CSDLMANAGER_H
#define CSDLMANAGER_H

#include "../include/constantes.h"
#include "../include/CSpriteAnimation.h"
#include "../include/ISingleton.h"

#include <SDL/SDL_ttf.h>
struct SDL_Surface;
union SDL_Event;


//**************************
//Manage Initialisation and shutdown of SDL functions
//**************************
class CSDLManager : public ISingleton< CSDLManager >
{
    private:
		DECLARE_SINGLETON( CSDLManager );

        SDL_Surface* m_Screen;      //Screen of the application

        CSpriteAnimation * m_vPlayerAnimations[MAX_PLAYERS];	    //Contains Animations needed by the player
        CSpriteAnimation * m_vEnemyAnimations[NUMBER_ENEMIES];	    //Contains Animations needed by the player
        CSpriteAnimation * m_vPlayerShotsAnimations[MAX_PLAYERS];       //animations for all shots of the player
        CSpriteAnimation * m_vEnemyShotsAnimations[NUMBER_ENEMIES];       //animations for all shots of ennemies
        CSpriteAnimation * m_vPowerUpAnimations[NUMBER_POWERUP];	    //Contains all Animations needed for powerup

        SDL_Surface * m_BackGroundMenu;           //surface of the background in the menu
        SDL_Surface * m_GameTitle;           //surface of the title of the game
        SDL_Surface * m_Menu[NUMBER_OPTION_MENU*2];           //surfaces of the option of the menu
                                                                    //we multiply it by 2 because there are option selected and options non selected
        SDL_Surface * m_Highscore_Menu;         //Highscores surface to draw in the menu
        SDL_Surface * m_Highscores_Game[MAX_PLAYERS+1];     //Highscores surface to draw in the game
        SDL_Surface * m_Lives[MAX_PLAYERS];     //Lives surface
        SDL_Surface * m_Numbers[10];     //Numbers surface

        TTF_Font * m_BigGameFont;      //font used if we have to write  text on the screen (big size)
                                            //other than surfaces describe above
        TTF_Font * m_LittleGameFont;      //font used if we have to write  text on the screen (little size)
                                            //other than surfaces describe above

        //**************************
        //Description : Constructor
        //Parameters : None
        //Note : Private because a single instance is needed
        //**************************
        CSDLManager();

        //**************************
        //Description : Destructor
        //Parameters : None
        //Note : None
        //**************************
        ~CSDLManager();

        //**************************
        //Description : Load the Surfaces needed by the game (player, enemies, shots, font, ...)
        //Parameters : None
        //Return Value : true if success, otherwise false
        //Note : None
        //**************************
        bool LoadSurfaces();

    public:
        //**************************
        //Description : Init the instance
        //Parameters : None
        //Return Value : None
        //Note : None
        //**************************
        virtual void Init();

        //**************************
        //Description : DeInit the instance
        //Parameters : None
        //Return Value : None
        //Note : None
        //**************************
        virtual void DeInit();

        //**************************
        //Description : Return the tab of animations for the player
        //Parameters : the player
        //Return Value : tab of animations
        //Note : None
        //**************************
        CSpriteAnimation* GetPlayerAnimations(int _iNumPlayer);

        //**************************
        //Description : Return the tab of animations for the player shots
        //Parameters : the player
        //Return Value : tab of animations
        //Note : None
        //**************************
        CSpriteAnimation* GetPlayerShotsAnimation(int _iNumPlayer);

        //**************************
        //Description : Return the tab of animations for the enemy
        //Parameters : the enemy
        //Return Value : tab of animations
        //Note : None
        //**************************
        CSpriteAnimation* GetEnemyAnimations(int _iNumEnemy);

        //**************************
        //Description : Return the tab of animations for the enemy shots
        //Parameters : the enemy
        //Return Value : tab of animations
        //Note : None
        //**************************
        CSpriteAnimation* GetEnemyShotsAnimation(int _iNumEnemy);

        //**************************
        //Description : Return the tab of animations for the powerups
        //Parameters : the type of power up
        //Return Value : tab of animations
        //Note : None
        //**************************
        CSpriteAnimation* GetPowerUpAnimations(int _iNumPowerUp);

        //**************************
        //Description : Return the surface of the background menu
        //Parameters : None
        //Return Value : surface of the background
        //Note : None
        //**************************
        SDL_Surface* GetBackgroundMenu();

        //**************************
        //Description : Return the surface for the title
        //Parameters : the surface for the title
        //Return Value : tab of animations
        //Note : None
        //**************************
        SDL_Surface* GetTitleSurface();

        //**************************
        //Description : Return the surfaces for the menu
        //Parameters : the surfaces for the menu
        //Return Value : tab of animations
        //Note : None
        //**************************
        SDL_Surface** GetMenuSurfaces();

        //**************************
        //Description : Return the surfaces for the highscore in the menu
        //Parameters : the surface for the highscore in the menu
        //Return Value : tab of animations
        //Note : None
        //**************************
        SDL_Surface* GetHighscoreMenuSurfaces();

        //**************************
        //Description : Return the surfaces for the highscore in the game
        //Parameters : the surface for the highscore in the game
        //Return Value : tab of animations
        //Note : None
        //**************************
        SDL_Surface** GetHighscoreGameSurfaces();

        //**************************
        //Description : Return the surfaces for the lives
        //Parameters : the surface for the lives
        //Return Value : tab of animations
        //Note : None
        //**************************
        SDL_Surface** GetLivesSurfaces();

        //**************************
        //Description : Return the surfaces for the numbers
        //Parameters : the surface for the numbers
        //Return Value : tab of animations
        //Note : None
        //**************************
        SDL_Surface** GetNumbersSurfaces();

        //**************************
        //Description : Return the big font of the game
        //Parameters : None
        //Return Value : the font
        //Note : None
        //**************************
        TTF_Font* GetBigGameFont();

        //**************************
        //Description : Return the little font of the game
        //Parameters : None
        //Return Value : the font
        //Note : None
        //**************************
        TTF_Font* GetLittleGameFont();

        //**************************
        //Description : Return the screen of the application
        //Parameters : None
        //Return Value : the screen
        //Note : None
        //**************************
        SDL_Surface* GetScreen();

        //**************************
        //Description : Flip the screen
        //Parameters : None
        //Return Value : None
        //Note : None
        //**************************
        void Flip();

};

#endif // CSDLMANAGER_H
